package org.example;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class ExampleEntityC_D {
    public static void main(String[] args) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory(Util.PERSISTENCE_UNIT);
        EntityManager em = emf.createEntityManager();
        EntityC entityC = new EntityC();
        EntityD entityD = new EntityD();
        entityD.setStr("testStringD");
        entityD.setRefEntityC(entityC);
        entityC.setRefEntityD(entityD);
        em.getTransaction().begin();
        em.persist(entityC);
        em.persist(entityD);
        em.getTransaction().commit();
        emf.close();
    }
}
